<?php
	require_once ("../../config.inc.php");
	require_once ("../../include/mysql.inc.php");
	require_once ("../../include/resLoad.inc.php");
	require_once ("../../include/util.inc.php");
	
	$resId = mysql_escape_string($_POST["id"]);
	$ip = Util::getIp();
	$resLoadDao = new ResLoad();
	$flag = $resLoadDao->add($ip, $resId);
	
	$dom = new DOMDocument("1.0","UTF-8");
	$result = $dom->createElement("result", $flag ? '1' : '0');
	$dom->appendChild($result);
	header("Content-type:text/xml");
	$xmlfile = $dom->saveXML();
	file_put_contents("../../xml_data/resload.xml",$xmlfile);
	echo $xmlfile;
	
?>